#!/usr/bin/python
# -*- coding: utf-8 -*-
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/copyleft/gpl.txt

from pisi.actionsapi import get
from pisi.actionsapi import kerneltools
from pisi.actionsapi import autotools
from pisi.actionsapi import pisitools

KDIR = kerneltools.getKernelVersion()

def setup():
    pisitools.dosed("Makefile", "(.*tftpboot$)", r"#\1")
    pisitools.dosed("os/linux/config.mk", "HAS_WPA_SUPPLICANT=n", "HAS_WPA_SUPPLICANT=y")
    pisitools.dosed("os/linux/config.mk", "HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=n", "HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y")

def build():
    autotools.make()

def install():
    pisitools.insinto("/lib/modules/%s/kernel/drivers/net/wireless" % KDIR, "os/linux/rt5370sta.ko")
    pisitools.insinto("/etc/Wireless/RT2870STA", "RT2870STA.dat")
    pisitools.insinto("/etc/Wireless/RT2870STA", "RT2870STACard.dat")
    pisitools.dodoc("README_STA_usb")

# By PiSiDo 2.0.0
